<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>购买申请</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico"> <link href="/game/Public/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/game/Public/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/game/Public/admin/css/animate.css" rel="stylesheet">
    <link href="/game/Public/admin/css/style.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-8">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>购买申请</h5>
                    </div>
                    <div class="ibox-content">
                        <form class="form-horizontal m-t" id="commentForm">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">购买数量：</label>
                                <div class="col-sm-4">
                                    <input id="num" name="num" minlength="2" type="text" class="form-control" required="" aria-required="true">
                                </div>
                                <span class="cred t1"></span>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-4">
                                    <button class="btn btn-primary" type="button">提交申请</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>

        </div>

    </div>


    <!-- 全局js -->
    <script src="/game/Public/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="/game/Public/admin/js/bootstrap.min.js?v=3.3.6"></script>

    <!-- 自定义js -->
    <script src="/game/Public/admin/js/content.js?v=1.0.0"></script>

    <!-- jQuery Validation plugin javascript-->
    <script src="/game/Public/admin/js/plugins/validate/jquery.validate.min.js"></script>
    <script src="/game/Public/admin/js/plugins/validate/messages_zh.min.js"></script>

    <!-- <script src="/game/Public/admin/js/demo/form-validate-demo.js"></script> -->

     <script type="text/javascript">
        $(".btn-primary").click(function() {
            if ($.trim($("#num").val()) == '') {
                $('.t1').html('请输入购买数量!');
                return false;
            }else{
                $('.t1').html('');
            }
            var params = $("input").serialize();
            var url = "<?php echo U('Admin/Admin/buySave');?>";
            $.ajax({
                type: "post",
                url: url,
                dataType: "json",
                data: params,
                success: function (data) {
                    if (data == 'success') {
                        alert('申请成功，等待审核！');
                        window.location.href = "<?php echo U('Admin/Admin/buyList');?>";
                    } else {
                        alert('申请失败！');
                    }
                }
            });
        });
    </script>   
    

</body>

</html>